<template>
  <div>

    <div class="banner" @click="handleBannerClick">
      <img class="banner-img"
           :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-number"><span class="iconfont">&#xe692;</span>{{this.bannerImgs.length}}</div>
        <div class="banner-tittle">{{this.sightName}}</div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="imgs"
                      v-show="showGallary"
                      @close="handleGallaryClick"
      ></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
  import CommonGallary from 'common/gallary/Gallary'
  import FadeAnimation from 'common/fade/Fade'

  export default {
    name: "Banner",
    props: {
      sightName: String,
      bannerImg: String,
      bannerImgs: Array
    },
    data() {
      return {
        showGallary: false,
        imgs: ['http://img1.qunarzz.com/sight/p55/201211/04/fbcab3e5d6479ce893835fbb.jpg_r_800x800_6360f514.jpg',
          'http://img1.qunarzz.com/wugc/p180/201306/16/7f08e81624346b1693835fbb.jpg_r_800x800_5f03ad73.jpg']

      }
    },
    methods: {
      handleBannerClick() {
        this.showGallary = true
      },
      handleGallaryClick() {
        this.showGallary = false
      }
    },
    components: {
      CommonGallary,
      FadeAnimation
    }
  }
</script>

<style scoped>
  .banner {
    position: relative;
    overflow: hidden;
    height: 0;
    padding-bottom: 50%;
  }

  .banner-img {
    width: 100%;
    /*height: 100%;*/
  }

  .banner-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1rem;
    line-height: .6rem;
    display: flex;
    background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
  }

  .banner-tittle {
    flex: 1;
    color: #ffffff;
    height: 1rem;
    overflow: hidden;
    line-height: 1.3rem;
    /*text-align: center;*/
    padding: 0 0.4rem;

  }

  .banner-number {
    padding: 0.4rem;
    height: .4rem;
    /*line-height: .4rem;*/
    color: #ffffff;
    border-radius: 20px;
    background-color: rgba(0, 0, 0, 0.4);
  }

</style>
